﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class VoteChoiceMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.VoteChoice>
    {
        public VoteChoiceMap()
        {
            // table
            //ToTable("CMS_VoteChoice");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.ChoiceTitle)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.VoteNum)
                
                .IsRequired();
            Property(t => t.PicUrl)
                
                .HasMaxLength(255)
                .IsOptional();
            Property(t => t.IsDefault)
                
                .IsRequired();
            Property(t => t.VoteId)
                
                .IsRequired();
            Property(t => t.OrderId)
                
                .IsRequired();

            // Relationships
            HasRequired(t => t.Vote)
            .WithMany(t => t.VoteChoices)
            .HasForeignKey(d => d.VoteId);

            //InitializeMapping();
        }
    }
}

